﻿import QtQuick 2.0

ListModel {
    id: root
    ListElement{
        Menabled: false
        MdevName: "网安板-1"
        McpuRate: 0
        MmemRate: 0
        McpuTemp: 0
        MvdoTemp: 0
        MhddTemp: 0
        MlinesMask: 0x7
        Mmac: "MAC1"
        Mip: "IP1"
        MtcaseStr: "等待连接"
        MtstatLevel: 0
        MtstatStr: ""
        Mttimes: 0
        Mcmdtimes: 0
        Mcmdprocess: 0
        Mtprocess: 0
        Mrefresh: 0     // 指示灯刷新
    }

    function addOne(){
        root.append({
                        Menabled: false,
                        MdevName: "",
                        McpuRate: 0,
                        MmemRate: 0,
                        McpuTemp: 0,
                        MvdoTemp: 0,
                        MhddTemp: 0,
                        MlinesMask: 0x7,
                        Mmac: "MAC1",
                        Mip: "IP1",
                        MtcaseStr: "等待连接",
                        MtstatLevel: 0,
                        MtstatStr: "",
                        Mttimes: 0,
                        Mcmdtimes: 0,
                        Mcmdprocess: 0,
                        Mtprocess: 0,
                        Mrefresh: 0,
                    })
        root.get(root.count - 1).MdevName  = mainwindow.devName + "-" + root.count
        root.get(root.count - 1).Mtprocess = 0;
        root.get(root.count - 1).Mcmdtimes = 0;
    }

    function removeLaterOne(){
        var lens = root.count
        if(lens > 1){
            lens = lens - 1
        }
        if(root.get(lens).Menabled === false)
            root.remove(lens)
    }
}
